<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: function.box_name.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

function smarty_function_box_name($params=array(), &$smarty) {
	global $db;
	$name = $params['name'];
	$class = $params['class'];
	unset($params['name']); unset($params['class']);
	$name_db = $db->db_query("SELECT
									box_title
								FROM
									".TABLE_BOXES_NAMES."
								WHERE
									box_name = '".$name."'
								AND
									language_id = '".$_SESSION['languages_id']."'
								AND
									status = '1'", true);

	if($name_db->_numOfRows) {
		$title = '';
		$bs  = $db->db_query("SELECT
									background_head,
									color_head
								FROM
									".TABLE_BOXES_STYLES."
								WHERE
									box_name = '".$name."'", true);
		if(isset($class))
			$extra_title .= ' box_'.$class.'_head';
		$title .= '<div class="box_head'.$extra_title.'"';
		if(($bs->fields['background_head']!='') || ($bs->fields['color_head']!=''))
			$title .= ' style="'.(($bs->fields['background_head']!='')?'background:'.$bs->fields['background_head'].';':'').(($bs->fields['color_head']!='')?'color:'.$bs->fields['color_head'].';':'').'"'."\n";
		$title .= '>'.$name_db->fields['box_title'].'</div>';

		return $title;

	} else
		return $title;
}